In digital still cameras and portable information terminal devices having a digital still camera function, such as video cameras and PDAs, image data corresponding to captured photographic images is recorded as digital data. However, since the image data has a large data size and requires a large memory capacity for recording, typically, the image data is compressed according to, for example, a JPEG (Joint Photographic Experts Group) method or the like before it is recorded.
FIG. 1 is a block diagram showing an example structure of a JPEG compression unit of the related art for compressing image data according to a JPEG method.
In FIG. 1, image data converted to an image format suitable for compression is input to a JPEG compression unit 1 through an input terminal 11, and is supplied to a DCT (Discrete Cosine Transform) unit 12. The DCT unit 12 performs a discrete cosine transform on the supplied image data to convert the image data from the time-domain component to the frequency-domain component, and supplies the resulting data to a quantization processor 13.
The quantization processor 13 adjusts the compression ratio of the image data based on a Q-table formed of a table of quantized coefficients supplied from a fixed-length Q-(quantized coefficient) table generation unit 17, and supplies the image data to a variable-length coding processor 14. The variable-length coding processor 14 encodes the image data with variable length coding such as Huffman coding, and the resulting compressed image data is output from an output terminal 19.
The variable-length coding processor 14 is also connected with a number-of-bytes calculation unit 15, and the compressed image data output from the variable-length coding processor 14 is also supplied to the number-of-bytes calculation unit 15. The number-of-bytes calculation unit 15 determines the number of bytes of the compressed image data corresponding to one screen, and supplies the result to a Q-scale calculation unit 16. The Q-scale calculation unit 16 calculates the deviation between the input number of bytes and an expected number of bytes after compressing the photographic image data to determine the amount of adjustment of the compression ratio (Q-scale), and supplies the determined Q-scale to the fixed-length Q-table generation unit 17.
The Q-table generation unit 17 generates a new Q-table based on the Q-scale supplied from the Q-scale calculation unit 16 and a predetermined Q-table supplied from a Q-table unit 18, and supplies the generated Q-table to the quantization processor 13.
The quantization processor 13 again adjusts the compression ratio of the image data based on the new Q-table supplied from the Q-table generation unit 17.
By repeating the foregoing compression process, the JPEG compression unit 1 can compress the input image data to the predetermined data size.
However, the above-described method causes a reduction in image quality more than necessary due to block noise or mosquito noise if the compression ratio is set high so that any type of image data can be compressed one time to a predetermined data size. Therefore, a problem is that, typically, the compression process must be performed, for example, two or three times in order to compress various types of image data using appropriate compression ratios, thus extending the time required for compression of image data.
Another problem is that the above-described method requires a memory for storing the original image data to be compressed since the compression process must be repeated, thus increasing the memory capacity required for compression.